/////////////////////////////////////////////////////
//	File Name	:	"CBase.h"
//
//	Author Name	:	Mason Miller
//
//	Purpose		:	To contain all related data and functionality for our game objects.
/////////////////////////////////////////////////////

#ifndef _CBASE_H_
#define _CBASE_H_

#include "IBaseInterface.h"

class CBase : public IBaseInterface
{
private:
	//	How many objects have a pointer to me
	unsigned int m_uiRefCount;

	//	Position
	float m_fPosX;
	float m_fPosY;

	//	Velocity
	float m_fVelX;
	float m_fVelY;

	//	Size
	int m_nWidth;
	int m_nHeight;

	//	ImageID
	int m_nImageID;
protected:
	int m_nType;
public:
	enum objectTypes {OBJ_BASE, OBJ_PLAYER = 0, OBJ_ENEMY, OBJ_SPIDER, OBJ_WORM, OBJ_GRENADE,
		OBJ_TURRET, OBJ_FIREWALL, OBJ_PISTOL_BULLET, OBJ_SHOTGUN_BULLET, OBJ_ROCKET_BULLET, OBJ_PICKUP, OBJ_MAX};

	CBase(void);
	virtual ~CBase(void);

	/////////////////////////////////////////////////////
	//	Function	:	Accessors
	//	Purpose		:	To get the specified type.
	/////////////////////////////////////////////////////
	float GetPosX(void)		{return m_fPosX;}
	float GetPosY(void)		{return m_fPosY;}
	float GetVelX(void)		{return m_fVelX;}
	float GetVelY(void)		{return m_fVelY;}
	int GetWidth(void)		{return m_nWidth;}
	int GetHeight(void)		{return m_nHeight;}
	int GetImageID(void)	{return m_nImageID;}
	int GetType(void) const {return m_nType;}
	virtual RECT GetRect(void);

	/////////////////////////////////////////////////////
	//	Function	:	Modifiers
	//	Purpose		:	To set the specified type.
	/////////////////////////////////////////////////////
	void SetPosX(const float fPosX)		{m_fPosX = fPosX;}
	void SetPosY(const float fPosY)		{m_fPosY = fPosY;}
	void SetVelX(float fVelX)			{m_fVelX = fVelX;}
	void SetVelY(float fVelY)			{m_fVelY = fVelY;}
	void SetWidth(int nWidth)			{m_nWidth = nWidth;}
	void SetHeight(int nHeight)			{m_nHeight = nHeight;}
	void SetImageID(int nImageID)		{m_nImageID = nImageID;}
	void SetType(int nType)				{m_nType = nType;}

	//	Input
	//	Update
	//	NOTE: Do Input at the top of Update if needed
	virtual void Update(float fElapsedTime);
	//	Render
	virtual void Render(void);

	void AddRef(void) {m_uiRefCount++;}

	void Release(void)
	{
		m_uiRefCount--; 

		if(m_uiRefCount == 0)
			delete this;
	}

	virtual bool CheckCollision(IBaseInterface* pBase);
};

#endif